import sys
sys.path.append("../")
import requests
import time

from controller.CommonController import *

con = CommonController({"func":"getAllData","model":"c_1","fields":["*"],"data":"1"})
data = con.run()
n = 1
for row in data:
    time.sleep(0.2)
    fileoption = row["url"].split("/")
    filename = fileoption[len(fileoption)-1]

    response = requests.get(row["url"])
    # 取出照片的二进制信息
    img = response.content

    print(img)
    path = 'd:\\images\\c4\\' + filename  # 定义保存文件的路径
    # 这里的wb，“w”表示写入，"b"表示写入的为二进制文本

    with open(path, 'wb') as f:
        f.write(img)    



